package cn.kgc.sacla

/**
 * @Author: yan.
 * @Description:
 * @Date:Created in 2022/1/15 12:05.
 * @Modified By:
 */
object ClassDemo07 {
  case class Person(var name:String,var age:Int){}

  def main(args: Array[String]): Unit = {
    val p1 = Person("张三",23)
    println(p1)

    val p2 = Person("张三",23)
    println(p1 == p2)

    //同一对象哈希值肯定相同，不同的对象哈希值一般不同
    println(p1.hashCode())
    println(p2.hashCode())

    val p3 = p2.copy(age=24)
    println(p3)
    println(p3.hashCode())
  }
}
